
#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#include <algorithm>
using namespace std;
int main()
{
    int n = 0,m = 0,k = 0;
    cin >> n >> m >> k;
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    int maxNum = INT_MIN;
    for(int i = 1;i <= n;++i)
    {
        for(int j = 1;j <= m;++j)
        {
            int tmp = 0;
            cin >> tmp;
            dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1] + tmp;
        }
    }
    for(int x1 = 1;x1 <= n;++x1)
    {
        for(int y1 = 1;y1 <= m;++y1)
        {
            for(int x2 = x1;x2 <= n;++x2)
            {
                for(int y2 = y1;y2 <= m;++y2)
                {
                    int maxNum = std::max(maxNum,dp[x2][y2] - dp[x2][y1-1] - dp[x1-1][y2] + dp[x1-1][y1-1]);
                }
            }
        }
    }
    cout << maxNum
    return 0;
}